<template>
  <el-scrollbar>
    <el-card>
      <v-md-editor v-model="text" height="400px"
                   :disabled-menus="[]"
                   left-toolbar="undo redo clear | h bold italic strikethrough quote todo-list tip | ul ol table hr | link image code uploadFile | save"
                   :toolbar="toolbar"
                   @upload-image="handleUploadImage"
      ></v-md-editor>
      <v-md-preview :text="text"></v-md-preview>
    </el-card>
  </el-scrollbar>
</template>


<script>
import {ref,unref, getCurrentInstance, watch, reactive, onMounted} from "vue";
import {ElMessage, ElMessageBox} from 'element-plus';
import {useRouter} from "vue-router";
export default {
  name: "index",
  props:["info"],
  emits:["update:info"],
  components:{

  },
  setup(props ,content){
    const router = useRouter()
    const {proxy} = getCurrentInstance();
    let data = {
      text: ref(),
    }
    //监听
    watch(() => [props.info], ([newInfo],[oldInfo]) => {
      // if (newInfo){
      //   Object.assign(data.form, newInfo)
      // content.emit('update:info',newInfo)
      // }
    })
    onMounted(async () => {

    })
    let methods = {
      handleUploadImage(){

      },
    }

    return {
      proxy,
      router,
      ...data,
      ...methods
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
